package test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

public class Main2 {

	protected Shell shell;
	private Text text;
	private Text text_1;
	private Text text_2;

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			Main2 window = new Main2();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {
		shell = new Shell();
		shell.setSize(450, 300);
		shell.setText("SWT Application");
		
		Button btnNewButton = new Button(shell, SWT.NONE);
		btnNewButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				
			text_1.setText(SoapTest.procesar(text.getText()));
			}
		});
		btnNewButton.setBounds(330, 10, 75, 25);
		btnNewButton.setText("Procesar");
		
		text = new Text(shell, SWT.BORDER);
		text.setText("http://wsf.cdyne.com/WeatherWS/Weather.asmx");
		text.setBounds(64, 10, 252, 21);
		
		Label lblUrl = new Label(shell, SWT.NONE);
		lblUrl.setBounds(21, 10, 37, 15);
		lblUrl.setText("Url:");
		
		text_1 = new Text(shell, SWT.BORDER | SWT.MULTI);
		text_1.setBounds(21, 93, 371, 142);
		
		Label lblResultadoServicio = new Label(shell, SWT.NONE);
		lblResultadoServicio.setText("Resultado Servicio:");
		lblResultadoServicio.setBounds(21, 72, 125, 15);
		
		Label lblParametros = new Label(shell, SWT.NONE);
		lblParametros.setBounds(21, 37, 37, 15);
		lblParametros.setText("pars:");
		
		text_2 = new Text(shell, SWT.BORDER);
		text_2.setBounds(64, 37, 76, 21);

	}
}
